# -*- coding: utf-8 -*-

import os, sys

def list_files(path):
    global file_list
    file_list = []
    for root, dirs, files in os.walk(path, True):
        for i in files:
            file_name = '%s\%s' % (root, i)
            file_list.append(file_name)
    return file_list

def find_file(lst,word):
    global result
    result = []
    for i in lst:
        if word in i:
            result.append(i)

    for i in lst:
        with open(i) as f:
            if word in f.readlines():
                #if i in result:
                #    continue
                result.append(i)
    return result



if __name__ == '__main__':
    key = raw_input('请输入关键字：\n')
    path = raw_input('请输入要搜索的目录：\n')
    lst = list_files(path)
    files = find_file(lst,key)

    for i in files:
        print i